package com.example.redis1;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.Tuple;

import java.util.Set;

public class RedisDemo1 {
    public static void main(String[] args) {
        //获取redis连接(空参，默认连接的是localhost:6379)
        Jedis jedis = new Jedis("192.168.247.132",6379);
//        jedis.auth("qf");

        //执行操作
        Set<Tuple> tuples = jedis.zrevrangeWithScores("wel_man", 0, -1);

        tuples.forEach(tuple -> {
            String welName = tuple.getElement();
            double score = tuple.getScore();

            System.out.println(welName + "获得票数为:" + score);
        });

        //释放资源
        jedis.close();
    }
}
